1. Field of the Invention
This invention generally relates to graphical user interfaces and more particularly, a method and apparatus for generating text components used in an editor.
2. Description of the Related Art
A wide variety of computer-based systems run applications having a graphical user interface (GUI). The GUI generates components on a display screen such as buttons, sliders, and selection boxes that a user selects with a pointing device such as a mouse. Many applications use a GUI because it is easier to use than a command-based interface.
To make GUI based applications more portable, software developers have attempted to develop GUI based applications in logical modules. Each logical module can be replaced or modified without affecting the operation of other related modules. The Smalltalk-80 object oriented programming language made a first step to improve GUI based application development by introducing the model, view, and controller (MVC) set of classes as illustrated in FIG. 1.
A model 102 represents the data and processes that use the data in an application. The data, typically stored as a stream of data in a file, may include metadata that describes the organization of information. This organization provides a logical structure of data elements that an application can manipulate. Each data element may include a data portion and corresponding attributes used to format the data portion. For example, a Hypertext Markup Language Document (HTML) has metadata called xe2x80x9ctagsxe2x80x9d which provides a logical and structural relationship between text elements in a document. The following example of HTML uses tags to create a logical structure within the document.
 less than HTML greater than 
. . . 
 less than INPUT TYPE=text NAME=inputfield1 VALUE=xe2x80x3xe2x80x3 greater than 
The angle brackets (i.e. xe2x80x9c less than xe2x80x9d, xe2x80x9c greater than xe2x80x9d) are used in HTML to indicate a tag. The structural and logical relationship between data elements can be defined using these HTML tags. Tags can also be used to describe more information about the data elements. For example, the HTML tag above indicates that the document is an HTML type document. The INPUT tag indicates that the text between the brackets defines a data element used for inputting values. Other attributes associated with the INPUT element such as TYPE, NAME, and VALUE further describe specific characteristics of the input element. For example, TYPE=text indicates that input element is of type text.
A view 104 in the MVC paradigm is the visual representation of the data in a GUI. The view generally includes GUI components such as buttons, sliders, check boxes, and pop-up menus displayed on a display screen. These views are generated using the style of a particular user interface. For example, a view may provide GUI components on a screen using a user interface style such as Windows, OpenLook, or Macintosh. Such interface styles may include the controls used to open, close, minimize, or maximize a window surrounding a particular GUI component. They also may describe buttons and other components as having two or three-dimensions buttons when displayed on a display screen.
Views and models communicate through a subscribe and notify protocol. The view subscribes to the model that may cause a particular view to change. When data associated with the model does change, the model notifies the views that depend on the model""s data. This notification allows the views to update the visual representation of data on the screen. For example, if the values in a spreadsheet are modified the model associated with these values notifies the corresponding view that a new set of values must be displayed.
A controller 106 object in the MVC paradigm determines the way a view responds to user input. Essentially, view 104 uses an instance of controller 106 to implement a particular interaction between view 104 and a user. For example, controller 106 may determine how view 104 responds to a keyboard or if view 104 uses pop-up menus. To change the interaction, one need only change controller 106 and not view 104. Using this design, the model, view, and controller portions of a GUI application can be changed and updated as modules.
In general, dividing applications into model, view, and control modules improved software development costs because portions of the applications could be reused. For example, the view portion of an application could be modified or replaced without affecting the model or control portions of the application. Unfortunately, specific applications such as text editors need more flexibility than the conventional MVC classes are capable of providing. Specifically, generating text editors with a variety of user interface styles is not greatly improved using conventional MVC classes.
Within a text editor application, there is a text component that processes the text and other components that operate the text editor such as buttons and pull-down menus. This text component may be used to format the text in the application and produce a visual representation of the text such as on a display device. Different types of text components can be developed to edit different types of text. For example, a text component for HTML can be developed that highlights keywords in HTML, performs basic HTML syntax checking, and allows a user to cut, paste, and insert HTML-based text.
Each text component also has a user interface style. The user interface style determines the shape and appearance of the window surrounding the text editor and the location of controls used to interact with the text component. For example, one user interface style may represent windows and buttons in three-dimensions on the display screen while another user interface style may only present windows on the display screen having two-dimensions.
Conventional MVC classes, however, do not provide a method of customizing the text component for different types of text and different types of user interfaces. Using conventional MVC classes, a separate text component must be generated for each type of text and each user. interface type. This occurs because conventional MVC classes couple a specific user interface style to each text component. Thus, to generate a text component with a new user interface, the software developer must create new text components in the new user interface style for each type of text supported by the text components. This increases development costs and storage space for holding each of the different text components. For example, there must be 9 different text components created to edit 3 different types of text such as HTML, C code, and Java code and 3 user interface styles such as the Windows user interface style, the MacIntosh user interface style, and the Motif user interface style. Each time a new text type or a new user interface style is added many more text components must be created.
To address these limitations, it is desirable to improve the method of customizing text components that edit a particular type of text and have a particular type of user interface style.
In accordance with methods and systems consistent with the present invention, an improved editor used on a computer system is provided that generates a text component corresponding to a selectable user interface style and the type of content associated with the text component. This improved design decouples the selection of the user interface style from the type of text a text component can edit. This allows a text component used to edit a particular type of text to be customized to many different user interface styles. Similarly, a text component designed for a particular user interface style can be customized to edit a number of different types of text. This saves on development costs because a single text component can be customized to edit numerous types of text and appear with different user interface styles. This also saves on storage because fewer text components must be stored in memory or secondary storage such as disk.
To generate the text component, the editor delegates determination of characteristics corresponding to the selected user interface style to a first component. The first component selects the user interface details for the text component but does not implement details associated with processing the particular type of content. Instead, the editor delegates determination of the content based characteristics to a second component. Content may be text used in editors, alphanumeric characters used in a spreadsheets, or other types of characters used in other applications. The text component is created by combining the content based characteristics with the user interface style characteristics. This customized text component is then used by the editor to edit the text using the selected user interface style.